{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     住院总收入_计费日期\n",
      "医院A     1000000\n"
     ]
    },
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "mode": "number",
         "title": {
          "text": "住院总收入"
         },
         "type": "indicator",
         "value": 1000000
        }
       ],
       "layout": {
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.express as px\n",
    "import plotly.graph_objects as go\n",
    "import pandas as pd\n",
    "\n",
    "df = pd.DataFrame({\n",
    "    \"住院总收入_计费日期\": [1000000],\n",
    "}, index=[\"医院A\"])\n",
    "\n",
    "print(df)\n",
    "\n",
    "if len(df) == 1:\n",
    "    fig = go.Figure(go.Indicator(\n",
    "        mode=\"number\",\n",
    "        value=df.iloc[0, 0],\n",
    "        title={\"text\": \"住院总收入\"}\n",
    "    ))\n",
    "else:\n",
    "    fig = px.pie(df, values=df.columns[0], names=df.index, title=\"住院总收入\")\n",
    "\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "module 'plotly.express' has no attribute 'indicator'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[3], line 5\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mplotly\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mgraph_objects\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mgo\u001b[39;00m\n\u001b[0;32m      4\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(df) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[1;32m----> 5\u001b[0m     fig \u001b[38;5;241m=\u001b[39m px\u001b[38;5;241m.\u001b[39mindicator(df, value\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m住院总收入_计费日期\u001b[39m\u001b[38;5;124m'\u001b[39m, \n\u001b[0;32m      6\u001b[0m                       title\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m去年住院总收入\u001b[39m\u001b[38;5;124m'\u001b[39m, \n\u001b[0;32m      7\u001b[0m                       mode\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnumber+gauge\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m      8\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m      9\u001b[0m     fig \u001b[38;5;241m=\u001b[39m go\u001b[38;5;241m.\u001b[39mFigure(go\u001b[38;5;241m.\u001b[39mPie(values\u001b[38;5;241m=\u001b[39mdf[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m住院总收入_计费日期\u001b[39m\u001b[38;5;124m'\u001b[39m], \n\u001b[0;32m     10\u001b[0m                           labels\u001b[38;5;241m=\u001b[39mdf\u001b[38;5;241m.\u001b[39mindex))\n",
      "\u001b[1;31mAttributeError\u001b[0m: module 'plotly.express' has no attribute 'indicator'"
     ]
    }
   ],
   "source": [
    "import plotly.express as px\n",
    "import plotly.graph_objects as go\n",
    "\n",
    "if len(df) == 1:\n",
    "    fig = px.indicator(df, value='住院总收入_计费日期', \n",
    "                      title='去年住院总收入', \n",
    "                      mode='number+gauge')\n",
    "else:\n",
    "    fig = go.Figure(go.Pie(values=df['住院总收入_计费日期'], \n",
    "                          labels=df.index))\n",
    "    fig.update_layout(title='去年住院总收入分布')\n",
    "\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "mode": "number",
         "title": {
          "text": "住院总收入 (计费日期)"
         },
         "type": "indicator",
         "value": 1000000
        }
       ],
       "layout": {
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.express as px\n",
    "import plotly.graph_objects as go\n",
    "\n",
    "if len(df) == 1:\n",
    "    fig = go.Figure(go.Indicator(\n",
    "        mode=\"number\",\n",
    "        value=df.iloc[0, 0],\n",
    "        title={\"text\": \"住院总收入 (计费日期)\"},\n",
    "    ))\n",
    "else:\n",
    "    fig = px.bar(df, x=df.index, y=df.columns[0], title=\"住院总收入 (计费日期)\")\n",
    "\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "mode": "number",
         "title": {
          "text": "住院总收入"
         },
         "type": "indicator",
         "value": 1000000
        }
       ],
       "layout": {
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.express as px\n",
    "import plotly.graph_objects as go\n",
    "\n",
    "if len(df) == 1:\n",
    "    fig = go.Figure(go.Indicator(\n",
    "        mode=\"number\",\n",
    "        value=df[\"住院总收入_计费日期\"].values[0],\n",
    "        title={\"text\": \"住院总收入\"}\n",
    "    ))\n",
    "else:\n",
    "    fig = px.bar(df, x=\"执行科室\", y=\"住院总收入_计费日期\", \n",
    "                 title=\"按科室统计去年住院收入总量\",\n",
    "                 labels={\"执行科室\": \"执行科室\", \"住院总收入_计费日期\": \"住院总收入\"})\n",
    "    fig.update_layout(xaxis_tickangle=-45)\n",
    "\n",
    "fig.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "cells": {
          "fill": {
           "color": "lightgrey"
          },
          "line": {
           "color": "darkslategray"
          },
          "values": [
           [
            100,
            90,
            80,
            90
           ],
           [
            95,
            85,
            75,
            95
           ]
          ]
         },
         "header": {
          "fill": {
           "color": "lightslategrey"
          },
          "line": {
           "color": "darkslategray"
          },
          "values": [
           "A Scores",
           "B Scores"
          ]
         },
         "type": "table"
        }
       ],
       "layout": {
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.graph_objects as go\n",
    "\n",
    "fig = go.Figure(data=[go.Table(header=dict(values=['A Scores', 'B Scores'],line_color='darkslategray',\n",
    "                    fill_color='lightslategrey'),\n",
    "                 cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]],line_color='darkslategray',\n",
    "                   fill_color='lightgrey'))\n",
    "                     ])\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "mode": "number",
         "title": {
          "text": "住院总收入_计费日期"
         },
         "type": "indicator",
         "value": 1000000
        }
       ],
       "layout": {
        "legend": {
         "orientation": "h",
         "x": 1,
         "xanchor": "right",
         "y": 1.02,
         "yanchor": "top"
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.graph_objects as go\n",
    "import pandas as pd\n",
    "\n",
    "df = pd.DataFrame({\n",
    "    \"住院总收入_计费日期\": [1000000],\n",
    "}, index=[\"医院A\"])\n",
    "\n",
    "if len(df) == 1:\n",
    "    fig = go.Figure(go.Indicator(\n",
    "        mode=\"number\",\n",
    "        value=df[\"住院总收入_计费日期\"].values[0],\n",
    "        title={\"text\": \"住院总收入_计费日期\"}\n",
    "    ))\n",
    "    # fig = go.Figure(go.Indicator(\n",
    "    #     mode=\"number\",\n",
    "    #     value=df[\"住院总收入_计费日期\"].values[0],\n",
    "    #     title={\"text\": \"住院总收入\"}\n",
    "    # ))\n",
    "else:\n",
    "    fig = go.Figure(data=[go.Table(\n",
    "        header=dict(values=[df.columns[0]]),\n",
    "        cells=dict(values=[df[df.columns[0]].tolist()])\n",
    "    )])\n",
    "\n",
    "fig.update_layout(legend=dict(\n",
    "    orientation=\"h\",\n",
    "    yanchor=\"top\",\n",
    "    y=1.02,\n",
    "    xanchor=\"right\",\n",
    "    x=1\n",
    "))\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "mode": "number",
         "title": {
          "text": "住院总收入_计费日期"
         },
         "type": "indicator",
         "value": 1000000
        }
       ],
       "layout": {
        "legend": {
         "bgcolor": "rgba(0,0,255,0.5)",
         "orientation": "h",
         "x": 0.8,
         "xanchor": "right",
         "y": 0.5,
         "yanchor": "bottom"
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig.update_layout(\n",
    "    legend=dict(\n",
    "        x=0.8,  # Adjust x-position (closer to 1 moves it right)\n",
    "        y=0.5,  # Adjust y-position (closer to 1 moves it up)\n",
    "        bgcolor=\"rgba(0,0,255,0.5)\",  # Optional: Set semi-transparent background\n",
    "    )\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "labels": [
          "A Scores",
          "B Scores"
         ],
         "type": "pie",
         "values": [
          360,
          350
         ]
        }
       ],
       "layout": {
        "legend": {
         "orientation": "h",
         "x": 0.5,
         "xanchor": "center",
         "y": -0.1
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.graph_objects as go\n",
    "\n",
    "# 原始数据\n",
    "a_scores = [100, 90, 80, 90]\n",
    "b_scores = [95, 85, 75, 95]\n",
    "\n",
    "# 汇总数据：求和\n",
    "sum_a = sum(a_scores)  # 360\n",
    "sum_b = sum(b_scores)  # 350\n",
    "\n",
    "# 定义标签和对应的数值\n",
    "labels = ['A Scores', 'B Scores']\n",
    "values = [sum_a, sum_b]\n",
    "\n",
    "# 创建饼图\n",
    "fig = go.Figure(data=[go.Pie(labels=labels, values=values)])\n",
    "\n",
    "# 设置图例在底部横排显示\n",
    "fig.update_layout(\n",
    "    legend=dict(\n",
    "        orientation=\"h\",  # 横向排列\n",
    "        y=-0.1,           # 放置在图的下方\n",
    "        x=0.5,\n",
    "        xanchor='center'\n",
    "    )\n",
    ")\n",
    "\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "hoverinfo": "label+value+percent",
         "labels": [
          "基本外科",
          "内科ICU一病房(东院)(普通)",
          "妇科内分泌与生殖中心",
          "核医学科PET中心(东院)(普通)",
          "血液内科一病房(东院)(普通)",
          "产科一病房",
          "内科ICU",
          "急诊科急诊综合一病房(东院)(普通)"
         ],
         "textinfo": "percent",
         "type": "pie",
         "values": [
          34242481.19000002,
          7529523.679999968,
          4357376.600000001,
          3964556,
          1688015.700000011,
          1004783.929999999,
          164183,
          0
         ]
        }
       ],
       "layout": {
        "legend": {
         "orientation": "h",
         "x": 0.5,
         "xanchor": "center",
         "y": -0.1
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "title": {
         "text": "Last Year's Inpatient Revenue by Department"
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.graph_objects as go\n",
    "\n",
    "df = pd.DataFrame([\n",
    "    {\n",
    "      \"住院总收入_计费日期\": 34242481.19000002,\n",
    "      \"执行科室\": \"基本外科\"\n",
    "    },\n",
    "    {\n",
    "      \"住院总收入_计费日期\": 0,\n",
    "      \"执行科室\": \"急诊科急诊综合一病房(东院)(普通)\"\n",
    "    },\n",
    "    {\n",
    "      \"住院总收入_计费日期\": 1004783.929999999,\n",
    "      \"执行科室\": \"产科一病房\"\n",
    "    },\n",
    "    {\n",
    "      \"住院总收入_计费日期\": 7529523.679999968,\n",
    "      \"执行科室\": \"内科ICU一病房(东院)(普通)\"\n",
    "    },\n",
    "    {\n",
    "      \"住院总收入_计费日期\": 4357376.600000001,\n",
    "      \"执行科室\": \"妇科内分泌与生殖中心\"\n",
    "    },\n",
    "    {\n",
    "      \"住院总收入_计费日期\": 1688015.700000011,\n",
    "      \"执行科室\": \"血液内科一病房(东院)(普通)\"\n",
    "    },\n",
    "    {\n",
    "      \"住院总收入_计费日期\": 3964556,\n",
    "      \"执行科室\": \"核医学科PET中心(东院)(普通)\"\n",
    "    },\n",
    "    {\n",
    "      \"住院总收入_计费日期\": 164183,\n",
    "      \"执行科室\": \"内科ICU\"\n",
    "    }])\n",
    "\n",
    "# Sort the DataFrame by the revenue in descending order\n",
    "df_sorted = df.sort_values(by='住院总收入_计费日期', ascending=False)\n",
    "\n",
    "# Take the top 10 entries\n",
    "top_10 = df_sorted.head(10)\n",
    "\n",
    "# Create the pie chart figure\n",
    "fig = go.Figure(data=[go.Pie(\n",
    "    labels=top_10['执行科室'],\n",
    "    values=top_10['住院总收入_计费日期'],\n",
    "    hoverinfo='label+value+percent',\n",
    "    textinfo='percent',\n",
    ")])\n",
    "\n",
    "# Update layout with legend configuration\n",
    "fig.update_layout(\n",
    "    legend=dict(\n",
    "        orientation=\"h\",\n",
    "        y=-0.1,\n",
    "        x=0.5,\n",
    "        xanchor='center'\n",
    "    ),\n",
    "    title=\"Last Year's Inpatient Revenue by Department\"\n",
    ")\n",
    "\n",
    "# Show the figure\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "marker": {
          "color": "red"
         },
         "orientation": "h",
         "text": [
          "基本外科",
          "内科ICU一病房(东院)(普通)",
          "妇科内分泌与生殖中心",
          "核医学科PET中心(东院)(普通)",
          "血液内科一病房(东院)(普通)",
          "产科一病房",
          "内科ICU",
          "急诊科急诊综合一病房(东院)(普通)"
         ],
         "textposition": "outside",
         "type": "bar",
         "x": [
          34242481.19000002,
          7529523.679999968,
          4357376.600000001,
          3964556,
          1688015.700000011,
          1004783.929999999,
          164183,
          0
         ],
         "y": [
          "基本外科",
          "内科ICU一病房(东院)(普通)",
          "妇科内分泌与生殖中心",
          "核医学科PET中心(东院)(普通)",
          "血液内科一病房(东院)(普通)",
          "产科一病房",
          "内科ICU",
          "急诊科急诊综合一病房(东院)(普通)"
         ]
        }
       ],
       "layout": {
        "plot_bgcolor": "rgba(0,0,0,0)",
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "title": {
         "text": ""
        },
        "xaxis": {
         "showticklabels": true
        },
        "yaxis": {
         "showticklabels": false
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df_sorted = df.sort_values(by='住院总收入_计费日期', ascending=False)\n",
    "\n",
    "# Take the top 10 entries\n",
    "top_10 = df_sorted.head(10)\n",
    "\n",
    "fig = go.Figure(go.Bar(\n",
    "        y=df_sorted['执行科室'],\n",
    "        x=df_sorted['住院总收入_计费日期'],\n",
    "        orientation='h',\n",
    "        text=df_sorted['执行科室'], # Add values as text on the bars\n",
    "        textposition='outside', # Place text inside the bars    middle bottom 'inside', 'outside', 'auto', 'none'\n",
    "        marker_color='red'\n",
    "    ))\n",
    "\n",
    "fig.update_layout(\n",
    "    title_text=\"\",\n",
    "    # yaxis=dict(autorange=\"reversed\"), # Reverse y-axis to display in descending order\n",
    "    yaxis=dict(showticklabels=False),\n",
    "    xaxis=dict(showticklabels=True), # show x axis labels\n",
    "    #paper_bgcolor='rgba(0,0,0,0)',  # Transparent background\n",
    "    plot_bgcolor='rgba(0,0,0,0)'\n",
    ")\n",
    "\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                      患者科室                   总收入\n",
      "0           乳腺外科(西院)(国际医疗)   6.435339390999999E7\n",
      "1               国际医疗(妇科肿瘤)  2.2008500540000003E7\n",
      "2    日间医疗中心妇科内分泌中心(西院)(普通)            2309952.29\n",
      "3               国际医疗(综合妇科)              -3268.25\n",
      "4                   核医学科门诊            5376148.57\n",
      "..                     ...                   ...\n",
      "297      全科医学科(普通内科门诊)(西院)               -234.53\n",
      "298              国际医疗部急诊眼科             284251.76\n",
      "299                  血液科门诊  1.1974238232999998E8\n",
      "300            肿瘤内科随访和复诊门诊               1334.99\n",
      "301              内分泌科互联网诊疗            7978493.93\n",
      "\n",
      "[302 rows x 2 columns]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "rows = [\n",
    "    [\n",
    "      \"乳腺外科(西院)(国际医疗)\",\n",
    "      \"6.435339390999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(妇科肿瘤)\",\n",
    "      \"2.2008500540000003E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心妇科内分泌中心(西院)(普通)\",\n",
    "      \"2309952.29\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(综合妇科)\",\n",
    "      \"-3268.25\"\n",
    "    ],\n",
    "    [\n",
    "      \"核医学科门诊\",\n",
    "      \"5376148.57\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部门诊\",\n",
    "      \"2.1901793810000002E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"放射科(转化楼)\",\n",
    "      \"331434.04\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需妇科内分泌及生殖门诊2\",\n",
    "      \"-1372.2\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需肝脏外科门诊2\",\n",
    "      \"1781495.4999999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"急诊口腔科\",\n",
    "      \"530491.51\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心耳鼻喉科(西院)(普通)\",\n",
    "      \"704611.0699999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心胸外科(西院)(普通)\",\n",
    "      \"4918330.220000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科肿瘤中心妇科二病房绒癌组(东院)(普通)\",\n",
    "      \"1.9840944490000002E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"心理医学科互联网诊疗\",\n",
    "      \"705394.8600000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"血管外科门诊(西院国际医疗)\",\n",
    "      \"350394.64\"\n",
    "    ],\n",
    "    [\n",
    "      \"检验科外院标本送检\",\n",
    "      \"20926.630000000005\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(全科医学科普通内科)\",\n",
    "      \"1.168839643E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"儿科门诊\",\n",
    "      \"9181598.09\"\n",
    "    ],\n",
    "    [\n",
    "      \"肾内科门诊(西院国际医疗)\",\n",
    "      \"2984285.61\"\n",
    "    ],\n",
    "    [\n",
    "      \"基本外科肠造口门诊\",\n",
    "      \"1127791.9\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(老年医学科)\",\n",
    "      \"423759.7100000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科内分泌与生殖中心\",\n",
    "      \"1.0559846290000001E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"卫干门诊(中医科)\",\n",
    "      \"155235.77999999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科内分泌与生殖中心内分泌(西院)(国际医疗)\",\n",
    "      \"1.0695059949999997E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科内分泌与生殖中心不孕不育门诊(西院)\",\n",
    "      \"-4601.43\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(口腔科)\",\n",
    "      \"1.213088897E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"老年医学科\",\n",
    "      \"9359315.760000004\"\n",
    "    ],\n",
    "    [\n",
    "      \"骨科\",\n",
    "      \"1.3441227873999998E8\"\n",
    "    ],\n",
    "    [\n",
    "      \"全科医学科(普通内科)\",\n",
    "      \"1.0158109200000001E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需胸外科门诊1\",\n",
    "      \"5794958.7299999995\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部急诊耳鼻喉科\",\n",
    "      \"610617.1099999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"耳鼻喉科互联网诊疗\",\n",
    "      \"216152.08000000007\"\n",
    "    ],\n",
    "    [\n",
    "      \"放疗科门诊\",\n",
    "      \"2.996413643000001E8\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需胸外科门诊2\",\n",
    "      \"5011519.78\"\n",
    "    ],\n",
    "    [\n",
    "      \"风湿免疫科门诊(西院)\",\n",
    "      \"-285.08\"\n",
    "    ],\n",
    "    [\n",
    "      \"神经外科门诊\",\n",
    "      \"1.2901710110000003E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"神经外科互联网诊疗\",\n",
    "      \"4316.36\"\n",
    "    ],\n",
    "    [\n",
    "      \"放射科血管造影(东院)\",\n",
    "      \"412.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"感染内科门诊(西院国际医疗)\",\n",
    "      \"1747845.66\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需老年医学科门诊2\",\n",
    "      \"699451.4000000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"耳鼻喉科门诊\",\n",
    "      \"1.4363771269999996E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"神经科门诊(西院国际医疗)\",\n",
    "      \"1.2354574219999997E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需老年综合门诊1\",\n",
    "      \"675754.26\"\n",
    "    ],\n",
    "    [\n",
    "      \"临床营养科互联网诊疗\",\n",
    "      \"1334046.05\"\n",
    "    ],\n",
    "    [\n",
    "      \"泌尿外科男科门诊\",\n",
    "      \"379616.04000000004\"\n",
    "    ],\n",
    "    [\n",
    "      \"急诊神经科\",\n",
    "      \"1.3725735460000003E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"医学美容中心整形美容外科(西院)\",\n",
    "      \"5263056.890000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(放射治疗科)\",\n",
    "      \"4926732.820000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"神经科门诊\",\n",
    "      \"5.476041143999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"病理科咨询门诊\",\n",
    "      \"377092.39\"\n",
    "    ],\n",
    "    [\n",
    "      \"急诊耳鼻喉科\",\n",
    "      \"1626362.54\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需肿瘤内科门诊(西院)1\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(麻醉科无痛诊疗)\",\n",
    "      \"6109793.090000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"麻醉科无痛诊疗门诊\",\n",
    "      \"1851796.5600000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"耳鼻喉科\",\n",
    "      \"2.2440828919999998E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"门诊部医科院医务室(东院)\",\n",
    "      \"69668.07999999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"儿科\",\n",
    "      \"1.6523579540000008E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(产科)\",\n",
    "      \"2.11629223E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部特约门诊\",\n",
    "      \"1.268484956E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"整形美容外科门诊\",\n",
    "      \"3041.4700000000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"肿瘤医学中心\",\n",
    "      \"2950386.27\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科内分泌与生殖中心阴道镜门诊(西院国际医疗)\",\n",
    "      \"698600.66\"\n",
    "    ],\n",
    "    [\n",
    "      \"口腔科门诊(西院)\",\n",
    "      \"1.046337273E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"超声介入互联网诊疗\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"感染内科互联网诊疗\",\n",
    "      \"812487.45\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心眼科(西院)(普通)\",\n",
    "      \"365004.83\"\n",
    "    ],\n",
    "    [\n",
    "      \"新冠肾内科互联网诊疗\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"综合外科病房(西院)(国际医疗)\",\n",
    "      \"852.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"生殖中心门诊(西院国际医疗)\",\n",
    "      \"-4340.28\"\n",
    "    ],\n",
    "    [\n",
    "      \"呼吸内科门诊(西院)\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"肾内科互联网诊疗\",\n",
    "      \"2306824.1100000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心消化内科(西院)(普通)\",\n",
    "      \"5798085.349999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"口腔科互联网诊疗\",\n",
    "      \"16913.379999999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"乳腺外科门诊\",\n",
    "      \"1637643.6899999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(变态反应科)\",\n",
    "      \"1.2986701840000004E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需感染内科门诊2\",\n",
    "      \"1764747.56\"\n",
    "    ],\n",
    "    [\n",
    "      \"新冠产科互联网诊疗\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"康复医学科门诊(西院)\",\n",
    "      \"752340.59\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需感染内科门诊1\",\n",
    "      \"1839929.1199999994\"\n",
    "    ],\n",
    "    [\n",
    "      \"泌尿外科门诊(西院国际医疗)\",\n",
    "      \"1948969.3900000004\"\n",
    "    ],\n",
    "    [\n",
    "      \"神经科互联网诊疗\",\n",
    "      \"6403441.249999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"整形美容外科创面医护联合门诊(西院)\",\n",
    "      \"165087.17\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(血管外科)\",\n",
    "      \"1716766.76\"\n",
    "    ],\n",
    "    [\n",
    "      \"血管外科(转化楼)\",\n",
    "      \"4346842.820000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"新冠神经科互联网诊疗\",\n",
    "      \"-770.4\"\n",
    "    ],\n",
    "    [\n",
    "      \"肝脏外科门诊(西院国际医疗)\",\n",
    "      \"2402360.88\"\n",
    "    ],\n",
    "    [\n",
    "      \"基本外科互联网诊疗\",\n",
    "      \"1056434.0500000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"新冠中医科互联网诊疗\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"胸外科(转化楼)\",\n",
    "      \"453288.01999999996\"\n",
    "    ],\n",
    "    [\n",
    "      \"缓和医学医护联合门诊(西院)\",\n",
    "      \"22673.579999999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(心内科)\",\n",
    "      \"1.3682646309999995E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(血液科)\",\n",
    "      \"3364831.2300000004\"\n",
    "    ],\n",
    "    [\n",
    "      \"急诊眼科\",\n",
    "      \"721847.0700000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"血液内科(西院)\",\n",
    "      \"1.2903199100000001E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"发热门诊\",\n",
    "      \"6297737.670000002\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需眼科门诊1\",\n",
    "      \"1.1278623360000003E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"皮科门诊\",\n",
    "      \"5.845773056000001E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需眼科门诊2\",\n",
    "      \"421283.7800000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"麻醉科(转化楼)\",\n",
    "      \"47125.13\"\n",
    "    ],\n",
    "    [\n",
    "      \"乳腺外科乳癌随访门诊(西院)\",\n",
    "      \"1.476484321E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"中医科互联网诊疗\",\n",
    "      \"269138.19\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部急诊外科\",\n",
    "      \"7743982.680000002\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需内分泌科门诊2\",\n",
    "      \"2.7691574990000006E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"新冠消化内科互联网诊疗\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"基本外科\",\n",
    "      \"1.4902728717999995E8\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需内分泌科门诊1\",\n",
    "      \"-440.95\"\n",
    "    ],\n",
    "    [\n",
    "      \"骨科门诊\",\n",
    "      \"2.7341351530000005E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"中医科门诊(西院国际医疗)\",\n",
    "      \"479679.35\"\n",
    "    ],\n",
    "    [\n",
    "      \"核医学科互联网诊疗\",\n",
    "      \"21948.79\"\n",
    "    ],\n",
    "    [\n",
    "      \"胸外科门诊(西院国际医疗)\",\n",
    "      \"3139413.8299999996\"\n",
    "    ],\n",
    "    [\n",
    "      \"放疗科门诊(西院)\",\n",
    "      \"3.616256669E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"消化内科\",\n",
    "      \"2.885042373999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部急诊整形外科\",\n",
    "      \"463418.5300000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(放射科)\",\n",
    "      \"549828.7300000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心泌尿外科(西院)(普通)\",\n",
    "      \"145559.87\"\n",
    "    ],\n",
    "    [\n",
    "      \"口腔科美容牙科门诊(西院)\",\n",
    "      \"276477.31\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心整形美容外科(西院)(普通)\",\n",
    "      \"6109197.439999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"中医科联合门诊(西院)\",\n",
    "      \"30301.93\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科内分泌与生殖中心试管婴儿门诊(西院)\",\n",
    "      \"4496620.850000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需产科门诊2\",\n",
    "      \"1241295.5999999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"变态反应科门诊\",\n",
    "      \"3.760875688000001E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(眼科)\",\n",
    "      \"6.50152197E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(肿瘤内科)\",\n",
    "      \"5184457.06\"\n",
    "    ],\n",
    "    [\n",
    "      \"肾内科(西院)\",\n",
    "      \"2414240.8799999994\"\n",
    "    ],\n",
    "    [\n",
    "      \"西单院区事务管理处疑难病会诊中心（西院）（特需）\",\n",
    "      \"144800.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"内分泌科门诊(西院)\",\n",
    "      \"1571805.16\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需儿科门诊2\",\n",
    "      \"1576072.4000000006\"\n",
    "    ],\n",
    "    [\n",
    "      \"耳鼻喉科门诊(西院国际医疗)\",\n",
    "      \"6194515.460000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"健康医学部体检咨询门诊(东院)\",\n",
    "      \"22695.51\"\n",
    "    ],\n",
    "    [\n",
    "      \"皮肤科\",\n",
    "      \"5905534.77\"\n",
    "    ],\n",
    "    [\n",
    "      \"产科中心妇科计划生育组（东院）\",\n",
    "      \"6276572.020000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心骨科(西院)(普通)\",\n",
    "      \"4135312.2700000005\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(骨科)\",\n",
    "      \"1.2631636670000002E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心妇产科学系(西院)(普通)\",\n",
    "      \"5547544.96\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需肿瘤内科门诊1\",\n",
    "      \"1380965.27\"\n",
    "    ],\n",
    "    [\n",
    "      \"泌尿外科互联网诊疗\",\n",
    "      \"307947.83999999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需肿瘤内科门诊2\",\n",
    "      \"41113.7\"\n",
    "    ],\n",
    "    [\n",
    "      \"产科中心产科组(东院)\",\n",
    "      \"9611239.53\"\n",
    "    ],\n",
    "    [\n",
    "      \"普通内科全科门诊\",\n",
    "      \"-50.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"内分泌科\",\n",
    "      \"1.695080754E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"生殖中心门诊(西院)\",\n",
    "      \"4.642865671000001E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"胸外科互联网诊疗\",\n",
    "      \"3161655.569999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需妇科肿瘤门诊2\",\n",
    "      \"2.1169924229999997E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"泌尿外科膀胱癌专科门诊\",\n",
    "      \"-3911.69\"\n",
    "    ],\n",
    "    [\n",
    "      \"皮肤科激光中心\",\n",
    "      \"1.4641791679999996E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"临床营养科门诊\",\n",
    "      \"5180312.699999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"老年医学门诊(西院国际医疗)\",\n",
    "      \"271658.01\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部急诊神经科\",\n",
    "      \"2178833.4500000007\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(神经外科)\",\n",
    "      \"513236.51000000007\"\n",
    "    ],\n",
    "    [\n",
    "      \"门诊部职工保健科(西院)\",\n",
    "      \"141855.74999999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"卫干门诊(西院)\",\n",
    "      \"1400980.8199999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"心内科门诊(西院)\",\n",
    "      \"3701218.3000000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"急诊科核酸检测门诊\",\n",
    "      \"6293.9\"\n",
    "    ],\n",
    "    [\n",
    "      \"临床营养科西院门诊\",\n",
    "      \"3301923.0700000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"血管外科\",\n",
    "      \"9.490645799999997E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"骨科门诊(西院)\",\n",
    "      \"110484.48\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需整形外科门诊(西院)1\",\n",
    "      \"128059.02999999996\"\n",
    "    ],\n",
    "    [\n",
    "      \"综合内科病房(西院)(国际医疗)\",\n",
    "      \"1.1708223320000004E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"西单院区事务管理处健康管理中心(西院)(普通)\",\n",
    "      \"4338685.08\"\n",
    "    ],\n",
    "    [\n",
    "      \"血液科门诊(西院)\",\n",
    "      \"881889.5800000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"消化内科门诊(西院国际医疗)\",\n",
    "      \"2.350419146E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心麻醉(西院)\",\n",
    "      \"1331222.9600000002\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需康复理疗门诊2\",\n",
    "      \"713242.0499999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"骨科互联网诊疗\",\n",
    "      \"351335.91\"\n",
    "    ],\n",
    "    [\n",
    "      \"乳腺外科门诊(西院国际医疗)\",\n",
    "      \"1.7429215810000006E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"心内科门诊(西院国际医疗)\",\n",
    "      \"6401205.8\"\n",
    "    ],\n",
    "    [\n",
    "      \"泌尿外科结石代谢评估门诊\",\n",
    "      \"7311.34\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需全科医学科(普通内科)2\",\n",
    "      \"474535.49\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需全科医学科(普通内科)1\",\n",
    "      \"700185.3200000002\"\n",
    "    ],\n",
    "    [\n",
    "      \"耳聋遗传咨询门诊\",\n",
    "      \"224183.03999999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科互联网诊疗\",\n",
    "      \"732008.44\"\n",
    "    ],\n",
    "    [\n",
    "      \"呼吸与危重症医学科(转化楼)\",\n",
    "      \"892929.8999999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(中医科)\",\n",
    "      \"2562019.139999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"泌尿外科\",\n",
    "      \"6.519136700000002E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(美容皮肤科)\",\n",
    "      \"-282344.35\"\n",
    "    ],\n",
    "    [\n",
    "      \"基本外科门诊\",\n",
    "      \"4.0789516679999985E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(妇科内分泌及生殖门诊)\",\n",
    "      \"8875682.69\"\n",
    "    ],\n",
    "    [\n",
    "      \"急诊科住院(东院)(普通)\",\n",
    "      \"4.100703470000001E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"变态（过敏）反应科门诊(西院国际医疗)\",\n",
    "      \"8704536.07\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需骨科门诊1\",\n",
    "      \"5767873.86\"\n",
    "    ],\n",
    "    [\n",
    "      \"神经外科\",\n",
    "      \"7.776485135E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需骨科门诊2\",\n",
    "      \"2149184.2800000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需肝外科门诊1\",\n",
    "      \"6447244.790000002\"\n",
    "    ],\n",
    "    [\n",
    "      \"临床营养科特需门诊1\",\n",
    "      \"747188.5299999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"康复医学科门诊\",\n",
    "      \"7870652.700000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"肠外肠内营养科门诊\",\n",
    "      \"-1443.64\"\n",
    "    ],\n",
    "    [\n",
    "      \"缓和医学门诊\",\n",
    "      \"172294.32\"\n",
    "    ],\n",
    "    [\n",
    "      \"放射科\",\n",
    "      \"214.8\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科肿瘤门诊\",\n",
    "      \"6.008162441999998E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科内分泌与生殖中心妇产科辅助生育中心(西院)\",\n",
    "      \"730.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"放射科CT(东院)\",\n",
    "      \"60.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科肿瘤互联网诊疗\",\n",
    "      \"1036479.3100000002\"\n",
    "    ],\n",
    "    [\n",
    "      \"感染内科门诊\",\n",
    "      \"1.0430345670000004E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科内分泌门诊2(西院)\",\n",
    "      \"7054974.1\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需中医科门诊1\",\n",
    "      \"9718711.23\"\n",
    "    ],\n",
    "    [\n",
    "      \"罕见病联合门诊\",\n",
    "      \"1.6902740939999998E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"临床营养科(西院国际医疗)\",\n",
    "      \"1550869.9600000004\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需中医科门诊2\",\n",
    "      \"1.3488102809999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"普通皮科复诊\",\n",
    "      \"1277655.48\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需变态反应科门诊2\",\n",
    "      \"6290513.969999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"核酸检测门诊（西院）\",\n",
    "      \"-80.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部\",\n",
    "      \"3.9588715239E8\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(超声诊断科)\",\n",
    "      \"1810993.9600000007\"\n",
    "    ],\n",
    "    [\n",
    "      \"中医科针灸室\",\n",
    "      \"2304523.6799999992\"\n",
    "    ],\n",
    "    [\n",
    "      \"药剂科临床药学室\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"心理医学科门诊(西院国际医疗)\",\n",
    "      \"1083199.7999999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需风湿免疫科门诊1\",\n",
    "      \"1.471505023E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需风湿免疫科门诊2\",\n",
    "      \"1.148487487E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"超声医学科介入(西院国际医疗)\",\n",
    "      \"193970.52\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(消化内科)\",\n",
    "      \"4.037603442999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(呼吸内科)\",\n",
    "      \"2.8766671000000004E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(风湿免疫科)\",\n",
    "      \"1.697092922E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"外科门诊\",\n",
    "      \"6066.52\"\n",
    "    ],\n",
    "    [\n",
    "      \"内分泌科门诊(西院国际医疗)\",\n",
    "      \"1.3387248630000003E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需耳鼻喉科门诊2\",\n",
    "      \"9809704.97\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部急诊妇产科\",\n",
    "      \"3936679.7299999995\"\n",
    "    ],\n",
    "    [\n",
    "      \"消化内科门诊(西院)\",\n",
    "      \"471481.95999999996\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心基本外科(西院)(普通)\",\n",
    "      \"2476730.13\"\n",
    "    ],\n",
    "    [\n",
    "      \"普通妇科门诊(西院)\",\n",
    "      \"1438106.1\"\n",
    "    ],\n",
    "    [\n",
    "      \"外科伤口专科门诊\",\n",
    "      \"232301.99999999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"乳腺外科门诊(西院)\",\n",
    "      \"6.107843023000001E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"中医科\",\n",
    "      \"3831660.1799999992\"\n",
    "    ],\n",
    "    [\n",
    "      \"基本外科(转化楼)\",\n",
    "      \"768272.9399999998\"\n",
    "    ],\n",
    "    [\n",
    "      \"整形美容外科应急门诊(西院国际医疗)\",\n",
    "      \"12987.89\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(儿科)\",\n",
    "      \"8417428.19\"\n",
    "    ],\n",
    "    [\n",
    "      \"新冠乳腺外科互联网诊疗\",\n",
    "      \"86.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需超声引导介入门诊1\",\n",
    "      \"1454970.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"肿瘤专科门诊(西院)\",\n",
    "      \"12761.94\"\n",
    "    ],\n",
    "    [\n",
    "      \"口腔科(西院)(国际医疗)\",\n",
    "      \"5748878.079999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需放射科门诊1\",\n",
    "      \"2383533.7400000007\"\n",
    "    ],\n",
    "    [\n",
    "      \"血友病门诊(西院)\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"普通妇科中心妇科组(东院)(普通)\",\n",
    "      \"1.6087663280000003E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"泌尿外科(转化楼)\",\n",
    "      \"64972.58\"\n",
    "    ],\n",
    "    [\n",
    "      \"产科门诊\",\n",
    "      \"1.696352649999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"核医学科门诊(西院)\",\n",
    "      \"1456755.31\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需基本外科门诊1\",\n",
    "      \"1.812578764E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"肝炎门诊\",\n",
    "      \"3991698.01\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需基本外科门诊2\",\n",
    "      \"4930780.109999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(缓和医学)\",\n",
    "      \"123981.78\"\n",
    "    ],\n",
    "    [\n",
    "      \"心外科互联网诊疗\",\n",
    "      \"22120.429999999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(胸外科)\",\n",
    "      \"4980278.919999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需麻醉科门诊2\",\n",
    "      \"3770.1\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需麻醉科门诊1\",\n",
    "      \"72064.99000000002\"\n",
    "    ],\n",
    "    [\n",
    "      \"血液科门诊(西院国际医疗)\",\n",
    "      \"2253099.0099999993\"\n",
    "    ],\n",
    "    [\n",
    "      \"临床药理研究中心\",\n",
    "      \"224023.24999999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"日间医疗中心乳腺外科(西院)(普通)\",\n",
    "      \"7649730.469999997\"\n",
    "    ],\n",
    "    [\n",
    "      \"耳鼻喉科门诊(西院)\",\n",
    "      \"328.29999999999995\"\n",
    "    ],\n",
    "    [\n",
    "      \"整形美容外科淋巴水肿护理门诊(西院)\",\n",
    "      \"34729.12\"\n",
    "    ],\n",
    "    [\n",
    "      \"眼科\",\n",
    "      \"3.7812538210000016E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"老年医学科门诊\",\n",
    "      \"4453862.590000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"临床药理研究中心研究门诊\",\n",
    "      \"515341.74\"\n",
    "    ],\n",
    "    [\n",
    "      \"康复医学科(西院国际医疗)\",\n",
    "      \"600862.64\"\n",
    "    ],\n",
    "    [\n",
    "      \"全科医学科(普通内科)(西院国际医疗)\",\n",
    "      \"858616.24\"\n",
    "    ],\n",
    "    [\n",
    "      \"血液内科互联网诊疗\",\n",
    "      \"5153662.9399999995\"\n",
    "    ],\n",
    "    [\n",
    "      \"内科门诊\",\n",
    "      \"5646604.13\"\n",
    "    ],\n",
    "    [\n",
    "      \"内科ICU\",\n",
    "      \"3.677611353E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"心外科门诊\",\n",
    "      \"2435410.9600000004\"\n",
    "    ],\n",
    "    [\n",
    "      \"门诊部保健科互联网诊疗\",\n",
    "      \"487885.60000000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(耳鼻喉科)\",\n",
    "      \"1.0871281209999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇科计划生育门诊(西院国际医疗)\",\n",
    "      \"1051490.2700000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"急诊内科\",\n",
    "      \"1.0993356936999997E8\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需心外科门诊1\",\n",
    "      \"186005.36000000002\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需心内科门诊1\",\n",
    "      \"5357634.729999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"消化内科互联网诊疗\",\n",
    "      \"4182681.3500000006\"\n",
    "    ],\n",
    "    [\n",
    "      \"心理医学科门诊\",\n",
    "      \"1.0756852400000002E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"妇泌与生殖中心妇四病房内分泌组\",\n",
    "      \"219.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"变态(过敏)反应科互联网诊疗\",\n",
    "      \"698153.8\"\n",
    "    ],\n",
    "    [\n",
    "      \"超声介入门诊\",\n",
    "      \"4498894.86\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(病理科)\",\n",
    "      \"2660790.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"风湿免疫科\",\n",
    "      \"2.4288530799999993E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"眼科门诊(西院)\",\n",
    "      \"5855.860000000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(神经科)\",\n",
    "      \"1.7020255339999996E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"血液内科\",\n",
    "      \"2.945251744E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需心理医学科门诊2\",\n",
    "      \"1276811.8800000006\"\n",
    "    ],\n",
    "    [\n",
    "      \"儿科互联网诊疗\",\n",
    "      \"2141169.6699999995\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需心内科门诊2\",\n",
    "      \"4012498.75\"\n",
    "    ],\n",
    "    [\n",
    "      \"罕见病医学科\",\n",
    "      \"2841680.73\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需放疗科门诊2\",\n",
    "      \"2565992.1700000004\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需放疗科门诊1\",\n",
    "      \"6826493.189999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"肿瘤内科门诊(西院国际医疗)\",\n",
    "      \"6025271.109999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"中医科门诊\",\n",
    "      \"4.107836060999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"消化内科门诊\",\n",
    "      \"3.1634786859999985E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(妇科计划生育)\",\n",
    "      \"4632223.989999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"外科门诊(西院)\",\n",
    "      \"0.0\"\n",
    "    ],\n",
    "    [\n",
    "      \"核医学科(西院国际医疗)\",\n",
    "      \"662521.2\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部急诊科\",\n",
    "      \"53800.02999999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"肾内科门诊(西院)\",\n",
    "      \"347978.0499999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"骨科门诊(西院国际医疗)\",\n",
    "      \"3676445.8400000003\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需中医科联合门诊(西院)\",\n",
    "      \"4489.43\"\n",
    "    ],\n",
    "    [\n",
    "      \"内分泌科门诊\",\n",
    "      \"8.354584825999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"肝炎门诊互联网诊疗\",\n",
    "      \"109262.51000000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"呼吸内科门诊\",\n",
    "      \"6.404497870999999E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"肿瘤内科(西院)\",\n",
    "      \"3.1990793910000004E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"肿瘤内科门诊\",\n",
    "      \"926266.4799999999\"\n",
    "    ],\n",
    "    [\n",
    "      \"放射科门诊\",\n",
    "      \"1.0868342330000002E7\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗(核医学科)\",\n",
    "      \"460466.61999999994\"\n",
    "    ],\n",
    "    [\n",
    "      \"特需妇科计划生育门诊2\",\n",
    "      \"3321761.790000001\"\n",
    "    ],\n",
    "    [\n",
    "      \"全科医学科(普通内科门诊)(西院)\",\n",
    "      \"-234.53\"\n",
    "    ],\n",
    "    [\n",
    "      \"国际医疗部急诊眼科\",\n",
    "      \"284251.76\"\n",
    "    ],\n",
    "    [\n",
    "      \"血液科门诊\",\n",
    "      \"1.1974238232999998E8\"\n",
    "    ],\n",
    "    [\n",
    "      \"肿瘤内科随访和复诊门诊\",\n",
    "      \"1334.99\"\n",
    "    ],\n",
    "    [\n",
    "      \"内分泌科互联网诊疗\",\n",
    "      \"7978493.93\"\n",
    "    ]\n",
    "]\n",
    "columns = [\"患者科室\", \"总收入\"]\n",
    "\n",
    "df = pd.DataFrame(rows, columns=columns)\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "患者科室     object\n",
      "总收入     float64\n",
      "dtype: object\n"
     ]
    }
   ],
   "source": [
    "df['总收入'] = df['总收入'].astype(\"float64\")\n",
    "print(df.dtypes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "       患者科室院区  门诊药品总收入_结算日期\n",
      "0  北京协和医院(东院)  1.211080e+09\n",
      "1  北京协和医院(西院)  3.323063e+08\n"
     ]
    }
   ],
   "source": [
    "data = [\n",
    "    {\n",
    "      \"患者科室院区\": \"北京协和医院(东院)\",\n",
    "      \"门诊药品总收入_结算日期\": 1211080286.6800997\n",
    "    },\n",
    "    {\n",
    "      \"患者科室院区\": \"北京协和医院(西院)\",\n",
    "      \"门诊药品总收入_结算日期\": 332306279.3499936\n",
    "    }\n",
    "]\n",
    "\n",
    "df = pd.DataFrame(data)\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "cells": {
          "values": [
           [
            "乳腺外科(西院)(国际医疗)",
            "国际医疗(妇科肿瘤)",
            "日间医疗中心妇科内分泌中心(西院)(普通)",
            "国际医疗(综合妇科)",
            "核医学科门诊",
            "国际医疗部门诊",
            "放射科(转化楼)",
            "特需妇科内分泌及生殖门诊2",
            "特需肝脏外科门诊2",
            "急诊口腔科",
            "日间医疗中心耳鼻喉科(西院)(普通)",
            "日间医疗中心胸外科(西院)(普通)",
            "妇科肿瘤中心妇科二病房绒癌组(东院)(普通)",
            "心理医学科互联网诊疗",
            "血管外科门诊(西院国际医疗)",
            "检验科外院标本送检",
            "国际医疗(全科医学科普通内科)",
            "儿科门诊",
            "肾内科门诊(西院国际医疗)",
            "基本外科肠造口门诊",
            "国际医疗(老年医学科)",
            "妇科内分泌与生殖中心",
            "卫干门诊(中医科)",
            "妇科内分泌与生殖中心内分泌(西院)(国际医疗)",
            "妇科内分泌与生殖中心不孕不育门诊(西院)",
            "国际医疗(口腔科)",
            "老年医学科",
            "骨科",
            "全科医学科(普通内科)",
            "特需胸外科门诊1",
            "国际医疗部急诊耳鼻喉科",
            "耳鼻喉科互联网诊疗",
            "放疗科门诊",
            "特需胸外科门诊2",
            "风湿免疫科门诊(西院)",
            "神经外科门诊",
            "神经外科互联网诊疗",
            "放射科血管造影(东院)",
            "感染内科门诊(西院国际医疗)",
            "特需老年医学科门诊2",
            "耳鼻喉科门诊",
            "神经科门诊(西院国际医疗)",
            "特需老年综合门诊1",
            "临床营养科互联网诊疗",
            "泌尿外科男科门诊",
            "急诊神经科",
            "医学美容中心整形美容外科(西院)",
            "国际医疗(放射治疗科)",
            "神经科门诊",
            "病理科咨询门诊",
            "急诊耳鼻喉科",
            "特需肿瘤内科门诊(西院)1",
            "国际医疗(麻醉科无痛诊疗)",
            "麻醉科无痛诊疗门诊",
            "耳鼻喉科",
            "门诊部医科院医务室(东院)",
            "儿科",
            "国际医疗(产科)",
            "国际医疗部特约门诊",
            "整形美容外科门诊",
            "肿瘤医学中心",
            "妇科内分泌与生殖中心阴道镜门诊(西院国际医疗)",
            "口腔科门诊(西院)",
            "超声介入互联网诊疗",
            "感染内科互联网诊疗",
            "日间医疗中心眼科(西院)(普通)",
            "新冠肾内科互联网诊疗",
            "综合外科病房(西院)(国际医疗)",
            "生殖中心门诊(西院国际医疗)",
            "呼吸内科门诊(西院)",
            "肾内科互联网诊疗",
            "日间医疗中心消化内科(西院)(普通)",
            "口腔科互联网诊疗",
            "乳腺外科门诊",
            "国际医疗(变态反应科)",
            "特需感染内科门诊2",
            "新冠产科互联网诊疗",
            "康复医学科门诊(西院)",
            "特需感染内科门诊1",
            "泌尿外科门诊(西院国际医疗)",
            "神经科互联网诊疗",
            "整形美容外科创面医护联合门诊(西院)",
            "国际医疗(血管外科)",
            "血管外科(转化楼)",
            "新冠神经科互联网诊疗",
            "肝脏外科门诊(西院国际医疗)",
            "基本外科互联网诊疗",
            "新冠中医科互联网诊疗",
            "胸外科(转化楼)",
            "缓和医学医护联合门诊(西院)",
            "国际医疗(心内科)",
            "国际医疗(血液科)",
            "急诊眼科",
            "血液内科(西院)",
            "发热门诊",
            "特需眼科门诊1",
            "皮科门诊",
            "特需眼科门诊2",
            "麻醉科(转化楼)",
            "乳腺外科乳癌随访门诊(西院)",
            "中医科互联网诊疗",
            "国际医疗部急诊外科",
            "特需内分泌科门诊2",
            "新冠消化内科互联网诊疗",
            "基本外科",
            "特需内分泌科门诊1",
            "骨科门诊",
            "中医科门诊(西院国际医疗)",
            "核医学科互联网诊疗",
            "胸外科门诊(西院国际医疗)",
            "放疗科门诊(西院)",
            "消化内科",
            "国际医疗部急诊整形外科",
            "国际医疗(放射科)",
            "日间医疗中心泌尿外科(西院)(普通)",
            "口腔科美容牙科门诊(西院)",
            "日间医疗中心整形美容外科(西院)(普通)",
            "中医科联合门诊(西院)",
            "妇科内分泌与生殖中心试管婴儿门诊(西院)",
            "特需产科门诊2",
            "变态反应科门诊",
            "国际医疗(眼科)",
            "国际医疗(肿瘤内科)",
            "肾内科(西院)",
            "西单院区事务管理处疑难病会诊中心（西院）（特需）",
            "内分泌科门诊(西院)",
            "特需儿科门诊2",
            "耳鼻喉科门诊(西院国际医疗)",
            "健康医学部体检咨询门诊(东院)",
            "皮肤科",
            "产科中心妇科计划生育组（东院）",
            "日间医疗中心骨科(西院)(普通)",
            "国际医疗(骨科)",
            "日间医疗中心妇产科学系(西院)(普通)",
            "特需肿瘤内科门诊1",
            "泌尿外科互联网诊疗",
            "特需肿瘤内科门诊2",
            "产科中心产科组(东院)",
            "普通内科全科门诊",
            "内分泌科",
            "生殖中心门诊(西院)",
            "胸外科互联网诊疗",
            "特需妇科肿瘤门诊2",
            "泌尿外科膀胱癌专科门诊",
            "皮肤科激光中心",
            "临床营养科门诊",
            "老年医学门诊(西院国际医疗)",
            "国际医疗部急诊神经科",
            "国际医疗(神经外科)",
            "门诊部职工保健科(西院)",
            "卫干门诊(西院)",
            "心内科门诊(西院)",
            "急诊科核酸检测门诊",
            "临床营养科西院门诊",
            "血管外科",
            "骨科门诊(西院)",
            "特需整形外科门诊(西院)1",
            "综合内科病房(西院)(国际医疗)",
            "西单院区事务管理处健康管理中心(西院)(普通)",
            "血液科门诊(西院)",
            "消化内科门诊(西院国际医疗)",
            "日间医疗中心麻醉(西院)",
            "特需康复理疗门诊2",
            "骨科互联网诊疗",
            "乳腺外科门诊(西院国际医疗)",
            "心内科门诊(西院国际医疗)",
            "泌尿外科结石代谢评估门诊",
            "特需全科医学科(普通内科)2",
            "特需全科医学科(普通内科)1",
            "耳聋遗传咨询门诊",
            "妇科互联网诊疗",
            "呼吸与危重症医学科(转化楼)",
            "国际医疗(中医科)",
            "泌尿外科",
            "国际医疗(美容皮肤科)",
            "基本外科门诊",
            "国际医疗(妇科内分泌及生殖门诊)",
            "急诊科住院(东院)(普通)",
            "变态（过敏）反应科门诊(西院国际医疗)",
            "特需骨科门诊1",
            "神经外科",
            "特需骨科门诊2",
            "特需肝外科门诊1",
            "临床营养科特需门诊1",
            "康复医学科门诊",
            "肠外肠内营养科门诊",
            "缓和医学门诊",
            "放射科",
            "妇科肿瘤门诊",
            "妇科内分泌与生殖中心妇产科辅助生育中心(西院)",
            "放射科CT(东院)",
            "妇科肿瘤互联网诊疗",
            "感染内科门诊",
            "妇科内分泌门诊2(西院)",
            "特需中医科门诊1",
            "罕见病联合门诊",
            "临床营养科(西院国际医疗)",
            "特需中医科门诊2",
            "普通皮科复诊",
            "特需变态反应科门诊2",
            "核酸检测门诊（西院）",
            "国际医疗部",
            "国际医疗(超声诊断科)",
            "中医科针灸室",
            "药剂科临床药学室",
            "心理医学科门诊(西院国际医疗)",
            "特需风湿免疫科门诊1",
            "特需风湿免疫科门诊2",
            "超声医学科介入(西院国际医疗)",
            "国际医疗(消化内科)",
            "国际医疗(呼吸内科)",
            "国际医疗(风湿免疫科)",
            "外科门诊",
            "内分泌科门诊(西院国际医疗)",
            "特需耳鼻喉科门诊2",
            "国际医疗部急诊妇产科",
            "消化内科门诊(西院)",
            "日间医疗中心基本外科(西院)(普通)",
            "普通妇科门诊(西院)",
            "外科伤口专科门诊",
            "乳腺外科门诊(西院)",
            "中医科",
            "基本外科(转化楼)",
            "整形美容外科应急门诊(西院国际医疗)",
            "国际医疗(儿科)",
            "新冠乳腺外科互联网诊疗",
            "特需超声引导介入门诊1",
            "肿瘤专科门诊(西院)",
            "口腔科(西院)(国际医疗)",
            "特需放射科门诊1",
            "血友病门诊(西院)",
            "普通妇科中心妇科组(东院)(普通)",
            "泌尿外科(转化楼)",
            "产科门诊",
            "核医学科门诊(西院)",
            "特需基本外科门诊1",
            "肝炎门诊",
            "特需基本外科门诊2",
            "国际医疗(缓和医学)",
            "心外科互联网诊疗",
            "国际医疗(胸外科)",
            "特需麻醉科门诊2",
            "特需麻醉科门诊1",
            "血液科门诊(西院国际医疗)",
            "临床药理研究中心",
            "日间医疗中心乳腺外科(西院)(普通)",
            "耳鼻喉科门诊(西院)",
            "整形美容外科淋巴水肿护理门诊(西院)",
            "眼科",
            "老年医学科门诊",
            "临床药理研究中心研究门诊",
            "康复医学科(西院国际医疗)",
            "全科医学科(普通内科)(西院国际医疗)",
            "血液内科互联网诊疗",
            "内科门诊",
            "内科ICU",
            "心外科门诊",
            "门诊部保健科互联网诊疗",
            "国际医疗(耳鼻喉科)",
            "妇科计划生育门诊(西院国际医疗)",
            "急诊内科",
            "特需心外科门诊1",
            "特需心内科门诊1",
            "消化内科互联网诊疗",
            "心理医学科门诊",
            "妇泌与生殖中心妇四病房内分泌组",
            "变态(过敏)反应科互联网诊疗",
            "超声介入门诊",
            "国际医疗(病理科)",
            "风湿免疫科",
            "眼科门诊(西院)",
            "国际医疗(神经科)",
            "血液内科",
            "特需心理医学科门诊2",
            "儿科互联网诊疗",
            "特需心内科门诊2",
            "罕见病医学科",
            "特需放疗科门诊2",
            "特需放疗科门诊1",
            "肿瘤内科门诊(西院国际医疗)",
            "中医科门诊",
            "消化内科门诊",
            "国际医疗(妇科计划生育)",
            "外科门诊(西院)",
            "核医学科(西院国际医疗)",
            "国际医疗部急诊科",
            "肾内科门诊(西院)",
            "骨科门诊(西院国际医疗)",
            "特需中医科联合门诊(西院)",
            "内分泌科门诊",
            "肝炎门诊互联网诊疗",
            "呼吸内科门诊",
            "肿瘤内科(西院)",
            "肿瘤内科门诊",
            "放射科门诊",
            "国际医疗(核医学科)",
            "特需妇科计划生育门诊2",
            "全科医学科(普通内科门诊)(西院)",
            "国际医疗部急诊眼科",
            "血液科门诊",
            "肿瘤内科随访和复诊门诊",
            "内分泌科互联网诊疗"
           ],
           [
            64353393.90999999,
            22008500.540000003,
            2309952.29,
            -3268.25,
            5376148.57,
            21901793.810000002,
            331434.04,
            -1372.2,
            1781495.4999999998,
            530491.51,
            704611.0699999998,
            4918330.220000001,
            19840944.490000002,
            705394.8600000001,
            350394.64,
            20926.630000000005,
            11688396.43,
            9181598.09,
            2984285.61,
            1127791.9,
            423759.7100000001,
            10559846.290000001,
            155235.77999999997,
            10695059.949999997,
            -4601.43,
            12130888.97,
            9359315.760000004,
            134412278.73999998,
            10158109.200000001,
            5794958.7299999995,
            610617.1099999999,
            216152.08000000007,
            299641364.3000001,
            5011519.78,
            -285.08,
            12901710.110000003,
            4316.36,
            412,
            1747845.66,
            699451.4000000001,
            14363771.269999996,
            12354574.219999997,
            675754.26,
            1334046.05,
            379616.04000000004,
            13725735.460000003,
            5263056.890000001,
            4926732.820000001,
            54760411.43999999,
            377092.39,
            1626362.54,
            0,
            6109793.090000001,
            1851796.5600000003,
            22440828.919999998,
            69668.07999999999,
            16523579.540000008,
            21162922.3,
            12684849.56,
            3041.4700000000003,
            2950386.27,
            698600.66,
            10463372.73,
            0,
            812487.45,
            365004.83,
            0,
            852,
            -4340.28,
            0,
            2306824.1100000003,
            5798085.349999999,
            16913.379999999997,
            1637643.6899999997,
            12986701.840000004,
            1764747.56,
            0,
            752340.59,
            1839929.1199999994,
            1948969.3900000004,
            6403441.249999998,
            165087.17,
            1716766.76,
            4346842.820000001,
            -770.4,
            2402360.88,
            1056434.0500000003,
            0,
            453288.01999999996,
            22673.579999999998,
            13682646.309999995,
            3364831.2300000004,
            721847.0700000001,
            12903199.100000001,
            6297737.670000002,
            11278623.360000003,
            58457730.56000001,
            421283.7800000001,
            47125.13,
            14764843.21,
            269138.19,
            7743982.680000002,
            27691574.990000006,
            0,
            149027287.17999995,
            -440.95,
            27341351.530000005,
            479679.35,
            21948.79,
            3139413.8299999996,
            36162566.69,
            28850423.73999999,
            463418.5300000001,
            549828.7300000001,
            145559.87,
            276477.31,
            6109197.439999999,
            30301.93,
            4496620.850000001,
            1241295.5999999999,
            37608756.88000001,
            65015219.7,
            5184457.06,
            2414240.8799999994,
            144800,
            1571805.16,
            1576072.4000000006,
            6194515.460000001,
            22695.51,
            5905534.77,
            6276572.020000001,
            4135312.2700000005,
            12631636.670000002,
            5547544.96,
            1380965.27,
            307947.83999999997,
            41113.7,
            9611239.53,
            -50,
            16950807.54,
            46428656.71000001,
            3161655.569999999,
            21169924.229999997,
            -3911.69,
            14641791.679999996,
            5180312.699999999,
            271658.01,
            2178833.4500000007,
            513236.51000000007,
            141855.74999999997,
            1400980.8199999998,
            3701218.3000000003,
            6293.9,
            3301923.0700000003,
            94906457.99999997,
            110484.48,
            128059.02999999996,
            11708223.320000004,
            4338685.08,
            881889.5800000001,
            23504191.46,
            1331222.9600000002,
            713242.0499999999,
            351335.91,
            17429215.810000006,
            6401205.8,
            7311.34,
            474535.49,
            700185.3200000002,
            224183.03999999998,
            732008.44,
            892929.8999999999,
            2562019.139999999,
            65191367.00000002,
            -282344.35,
            40789516.679999985,
            8875682.69,
            41007034.70000001,
            8704536.07,
            5767873.86,
            77764851.35,
            2149184.2800000003,
            6447244.790000002,
            747188.5299999998,
            7870652.700000001,
            -1443.64,
            172294.32,
            214.8,
            60081624.41999998,
            730,
            60,
            1036479.3100000002,
            10430345.670000004,
            7054974.1,
            9718711.23,
            16902740.939999998,
            1550869.9600000004,
            13488102.809999999,
            1277655.48,
            6290513.969999998,
            -80,
            395887152.39,
            1810993.9600000007,
            2304523.6799999992,
            0,
            1083199.7999999998,
            14715050.23,
            11484874.87,
            193970.52,
            40376034.42999999,
            28766671.000000004,
            16970929.22,
            6066.52,
            13387248.630000003,
            9809704.97,
            3936679.7299999995,
            471481.95999999996,
            2476730.13,
            1438106.1,
            232301.99999999997,
            61078430.23000001,
            3831660.1799999992,
            768272.9399999998,
            12987.89,
            8417428.19,
            86,
            1454970,
            12761.94,
            5748878.079999997,
            2383533.7400000007,
            0,
            16087663.280000003,
            64972.58,
            16963526.49999999,
            1456755.31,
            18125787.64,
            3991698.01,
            4930780.109999999,
            123981.78,
            22120.429999999997,
            4980278.919999999,
            3770.1,
            72064.99000000002,
            2253099.0099999993,
            224023.24999999997,
            7649730.469999997,
            328.29999999999995,
            34729.12,
            37812538.210000016,
            4453862.590000001,
            515341.74,
            600862.64,
            858616.24,
            5153662.9399999995,
            5646604.13,
            36776113.53,
            2435410.9600000004,
            487885.60000000003,
            10871281.209999999,
            1051490.2700000003,
            109933569.36999997,
            186005.36000000002,
            5357634.729999999,
            4182681.3500000006,
            10756852.400000002,
            219,
            698153.8,
            4498894.86,
            2660790,
            24288530.799999993,
            5855.860000000001,
            17020255.339999996,
            29452517.44,
            1276811.8800000006,
            2141169.6699999995,
            4012498.75,
            2841680.73,
            2565992.1700000004,
            6826493.189999999,
            6025271.109999999,
            41078360.60999999,
            31634786.859999985,
            4632223.989999999,
            0,
            662521.2,
            53800.02999999999,
            347978.0499999999,
            3676445.8400000003,
            4489.43,
            83545848.25999999,
            109262.51000000001,
            64044978.70999999,
            31990793.910000004,
            926266.4799999999,
            10868342.330000002,
            460466.61999999994,
            3321761.790000001,
            -234.53,
            284251.76,
            119742382.32999998,
            1334.99,
            7978493.93
           ]
          ]
         },
         "header": {
          "values": [
           "患者科室",
           "总收入"
          ]
         },
         "type": "table"
        }
       ],
       "layout": {
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#f2f5fa"
            },
            "error_y": {
             "color": "#f2f5fa"
            },
            "marker": {
             "line": {
              "color": "rgb(17,17,17)",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "rgb(17,17,17)",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#A2B1C6",
             "gridcolor": "#506784",
             "linecolor": "#506784",
             "minorgridcolor": "#506784",
             "startlinecolor": "#A2B1C6"
            },
            "baxis": {
             "endlinecolor": "#A2B1C6",
             "gridcolor": "#506784",
             "linecolor": "#506784",
             "minorgridcolor": "#506784",
             "startlinecolor": "#A2B1C6"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "marker": {
             "line": {
              "color": "#283442"
             }
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "line": {
              "color": "#283442"
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#506784"
             },
             "line": {
              "color": "rgb(17,17,17)"
             }
            },
            "header": {
             "fill": {
              "color": "#2a3f5f"
             },
             "line": {
              "color": "rgb(17,17,17)"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#f2f5fa",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#f2f5fa"
          },
          "geo": {
           "bgcolor": "rgb(17,17,17)",
           "lakecolor": "rgb(17,17,17)",
           "landcolor": "rgb(17,17,17)",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "#506784"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "dark"
          },
          "paper_bgcolor": "rgb(17,17,17)",
          "plot_bgcolor": "rgb(17,17,17)",
          "polar": {
           "angularaxis": {
            "gridcolor": "#506784",
            "linecolor": "#506784",
            "ticks": ""
           },
           "bgcolor": "rgb(17,17,17)",
           "radialaxis": {
            "gridcolor": "#506784",
            "linecolor": "#506784",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "rgb(17,17,17)",
            "gridcolor": "#506784",
            "gridwidth": 2,
            "linecolor": "#506784",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#C8D4E3"
           },
           "yaxis": {
            "backgroundcolor": "rgb(17,17,17)",
            "gridcolor": "#506784",
            "gridwidth": 2,
            "linecolor": "#506784",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#C8D4E3"
           },
           "zaxis": {
            "backgroundcolor": "rgb(17,17,17)",
            "gridcolor": "#506784",
            "gridwidth": 2,
            "linecolor": "#506784",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#C8D4E3"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#f2f5fa"
           }
          },
          "sliderdefaults": {
           "bgcolor": "#C8D4E3",
           "bordercolor": "rgb(17,17,17)",
           "borderwidth": 1,
           "tickwidth": 0
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "#506784",
            "linecolor": "#506784",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "#506784",
            "linecolor": "#506784",
            "ticks": ""
           },
           "bgcolor": "rgb(17,17,17)",
           "caxis": {
            "gridcolor": "#506784",
            "linecolor": "#506784",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "updatemenudefaults": {
           "bgcolor": "#506784",
           "borderwidth": 0
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "#283442",
           "linecolor": "#506784",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "#283442",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "#283442",
           "linecolor": "#506784",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "#283442",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.graph_objects as go\n",
    "\n",
    "if len(df) == 1:\n",
    "    fig = go.Figure(go.Indicator(\n",
    "        mode=\"number\",\n",
    "        value=df['总收入'].values[0],\n",
    "        title={\"text\": f\"{df['患者科室'].values[0]} 的总收入\"}\n",
    "    ))\n",
    "elif len(df) > 1:\n",
    "    if len(df) <= 15:\n",
    "        fig = go.Figure(go.Pie(\n",
    "            labels=df['患者科室'],\n",
    "            values=df['总收入'],\n",
    "            name='总收入',\n",
    "            legendgroup='总收入'\n",
    "        ))\n",
    "        fig.update_layout(legend=dict(\n",
    "            orientation=\"h\",\n",
    "            yanchor=\"bottom\",\n",
    "            y=1.02,\n",
    "            xanchor=\"right\",\n",
    "            x=1\n",
    "        ))\n",
    "    else:\n",
    "        fig = go.Figure(go.Table(\n",
    "            header=dict(values=['患者科室', '总收入']),\n",
    "            cells=dict(values=[df['患者科室'], df['总收入']])\n",
    "        ))\n",
    "else:\n",
    "    fig = go.Figure(go.Indicator(\n",
    "        mode=\"number\",\n",
    "        value=0,\n",
    "        title={\"text\": \"无数据\"}\n",
    "    ))\n",
    "\n",
    "fig.update_layout(template='plotly_dark')\n",
    "\n",
    "fig.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['患者科室']\n"
     ]
    }
   ],
   "source": [
    "numeric_cols = df.select_dtypes(include=[\"number\"]).columns.tolist()\n",
    "categorical_cols = df.select_dtypes(\n",
    "    include=[\"object\", \"category\"]\n",
    ").columns.tolist()\n",
    "\n",
    "print(categorical_cols)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "患者科室=%{x}<br>总收入=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "乳腺外科(西院)(国际医疗)",
          "国际医疗(妇科肿瘤)",
          "日间医疗中心妇科内分泌中心(西院)(普通)",
          "国际医疗(综合妇科)",
          "核医学科门诊",
          "国际医疗部门诊",
          "放射科(转化楼)",
          "特需妇科内分泌及生殖门诊2",
          "特需肝脏外科门诊2",
          "急诊口腔科",
          "日间医疗中心耳鼻喉科(西院)(普通)",
          "日间医疗中心胸外科(西院)(普通)",
          "妇科肿瘤中心妇科二病房绒癌组(东院)(普通)",
          "心理医学科互联网诊疗",
          "血管外科门诊(西院国际医疗)",
          "检验科外院标本送检",
          "国际医疗(全科医学科普通内科)",
          "儿科门诊",
          "肾内科门诊(西院国际医疗)",
          "基本外科肠造口门诊",
          "国际医疗(老年医学科)",
          "妇科内分泌与生殖中心",
          "卫干门诊(中医科)",
          "妇科内分泌与生殖中心内分泌(西院)(国际医疗)",
          "妇科内分泌与生殖中心不孕不育门诊(西院)",
          "国际医疗(口腔科)",
          "老年医学科",
          "骨科",
          "全科医学科(普通内科)",
          "特需胸外科门诊1",
          "国际医疗部急诊耳鼻喉科",
          "耳鼻喉科互联网诊疗",
          "放疗科门诊",
          "特需胸外科门诊2",
          "风湿免疫科门诊(西院)",
          "神经外科门诊",
          "神经外科互联网诊疗",
          "放射科血管造影(东院)",
          "感染内科门诊(西院国际医疗)",
          "特需老年医学科门诊2",
          "耳鼻喉科门诊",
          "神经科门诊(西院国际医疗)",
          "特需老年综合门诊1",
          "临床营养科互联网诊疗",
          "泌尿外科男科门诊",
          "急诊神经科",
          "医学美容中心整形美容外科(西院)",
          "国际医疗(放射治疗科)",
          "神经科门诊",
          "病理科咨询门诊",
          "急诊耳鼻喉科",
          "特需肿瘤内科门诊(西院)1",
          "国际医疗(麻醉科无痛诊疗)",
          "麻醉科无痛诊疗门诊",
          "耳鼻喉科",
          "门诊部医科院医务室(东院)",
          "儿科",
          "国际医疗(产科)",
          "国际医疗部特约门诊",
          "整形美容外科门诊",
          "肿瘤医学中心",
          "妇科内分泌与生殖中心阴道镜门诊(西院国际医疗)",
          "口腔科门诊(西院)",
          "超声介入互联网诊疗",
          "感染内科互联网诊疗",
          "日间医疗中心眼科(西院)(普通)",
          "新冠肾内科互联网诊疗",
          "综合外科病房(西院)(国际医疗)",
          "生殖中心门诊(西院国际医疗)",
          "呼吸内科门诊(西院)",
          "肾内科互联网诊疗",
          "日间医疗中心消化内科(西院)(普通)",
          "口腔科互联网诊疗",
          "乳腺外科门诊",
          "国际医疗(变态反应科)",
          "特需感染内科门诊2",
          "新冠产科互联网诊疗",
          "康复医学科门诊(西院)",
          "特需感染内科门诊1",
          "泌尿外科门诊(西院国际医疗)",
          "神经科互联网诊疗",
          "整形美容外科创面医护联合门诊(西院)",
          "国际医疗(血管外科)",
          "血管外科(转化楼)",
          "新冠神经科互联网诊疗",
          "肝脏外科门诊(西院国际医疗)",
          "基本外科互联网诊疗",
          "新冠中医科互联网诊疗",
          "胸外科(转化楼)",
          "缓和医学医护联合门诊(西院)",
          "国际医疗(心内科)",
          "国际医疗(血液科)",
          "急诊眼科",
          "血液内科(西院)",
          "发热门诊",
          "特需眼科门诊1",
          "皮科门诊",
          "特需眼科门诊2",
          "麻醉科(转化楼)",
          "乳腺外科乳癌随访门诊(西院)",
          "中医科互联网诊疗",
          "国际医疗部急诊外科",
          "特需内分泌科门诊2",
          "新冠消化内科互联网诊疗",
          "基本外科",
          "特需内分泌科门诊1",
          "骨科门诊",
          "中医科门诊(西院国际医疗)",
          "核医学科互联网诊疗",
          "胸外科门诊(西院国际医疗)",
          "放疗科门诊(西院)",
          "消化内科",
          "国际医疗部急诊整形外科",
          "国际医疗(放射科)",
          "日间医疗中心泌尿外科(西院)(普通)",
          "口腔科美容牙科门诊(西院)",
          "日间医疗中心整形美容外科(西院)(普通)",
          "中医科联合门诊(西院)",
          "妇科内分泌与生殖中心试管婴儿门诊(西院)",
          "特需产科门诊2",
          "变态反应科门诊",
          "国际医疗(眼科)",
          "国际医疗(肿瘤内科)",
          "肾内科(西院)",
          "西单院区事务管理处疑难病会诊中心（西院）（特需）",
          "内分泌科门诊(西院)",
          "特需儿科门诊2",
          "耳鼻喉科门诊(西院国际医疗)",
          "健康医学部体检咨询门诊(东院)",
          "皮肤科",
          "产科中心妇科计划生育组（东院）",
          "日间医疗中心骨科(西院)(普通)",
          "国际医疗(骨科)",
          "日间医疗中心妇产科学系(西院)(普通)",
          "特需肿瘤内科门诊1",
          "泌尿外科互联网诊疗",
          "特需肿瘤内科门诊2",
          "产科中心产科组(东院)",
          "普通内科全科门诊",
          "内分泌科",
          "生殖中心门诊(西院)",
          "胸外科互联网诊疗",
          "特需妇科肿瘤门诊2",
          "泌尿外科膀胱癌专科门诊",
          "皮肤科激光中心",
          "临床营养科门诊",
          "老年医学门诊(西院国际医疗)",
          "国际医疗部急诊神经科",
          "国际医疗(神经外科)",
          "门诊部职工保健科(西院)",
          "卫干门诊(西院)",
          "心内科门诊(西院)",
          "急诊科核酸检测门诊",
          "临床营养科西院门诊",
          "血管外科",
          "骨科门诊(西院)",
          "特需整形外科门诊(西院)1",
          "综合内科病房(西院)(国际医疗)",
          "西单院区事务管理处健康管理中心(西院)(普通)",
          "血液科门诊(西院)",
          "消化内科门诊(西院国际医疗)",
          "日间医疗中心麻醉(西院)",
          "特需康复理疗门诊2",
          "骨科互联网诊疗",
          "乳腺外科门诊(西院国际医疗)",
          "心内科门诊(西院国际医疗)",
          "泌尿外科结石代谢评估门诊",
          "特需全科医学科(普通内科)2",
          "特需全科医学科(普通内科)1",
          "耳聋遗传咨询门诊",
          "妇科互联网诊疗",
          "呼吸与危重症医学科(转化楼)",
          "国际医疗(中医科)",
          "泌尿外科",
          "国际医疗(美容皮肤科)",
          "基本外科门诊",
          "国际医疗(妇科内分泌及生殖门诊)",
          "急诊科住院(东院)(普通)",
          "变态（过敏）反应科门诊(西院国际医疗)",
          "特需骨科门诊1",
          "神经外科",
          "特需骨科门诊2",
          "特需肝外科门诊1",
          "临床营养科特需门诊1",
          "康复医学科门诊",
          "肠外肠内营养科门诊",
          "缓和医学门诊",
          "放射科",
          "妇科肿瘤门诊",
          "妇科内分泌与生殖中心妇产科辅助生育中心(西院)",
          "放射科CT(东院)",
          "妇科肿瘤互联网诊疗",
          "感染内科门诊",
          "妇科内分泌门诊2(西院)",
          "特需中医科门诊1",
          "罕见病联合门诊",
          "临床营养科(西院国际医疗)",
          "特需中医科门诊2",
          "普通皮科复诊",
          "特需变态反应科门诊2",
          "核酸检测门诊（西院）",
          "国际医疗部",
          "国际医疗(超声诊断科)",
          "中医科针灸室",
          "药剂科临床药学室",
          "心理医学科门诊(西院国际医疗)",
          "特需风湿免疫科门诊1",
          "特需风湿免疫科门诊2",
          "超声医学科介入(西院国际医疗)",
          "国际医疗(消化内科)",
          "国际医疗(呼吸内科)",
          "国际医疗(风湿免疫科)",
          "外科门诊",
          "内分泌科门诊(西院国际医疗)",
          "特需耳鼻喉科门诊2",
          "国际医疗部急诊妇产科",
          "消化内科门诊(西院)",
          "日间医疗中心基本外科(西院)(普通)",
          "普通妇科门诊(西院)",
          "外科伤口专科门诊",
          "乳腺外科门诊(西院)",
          "中医科",
          "基本外科(转化楼)",
          "整形美容外科应急门诊(西院国际医疗)",
          "国际医疗(儿科)",
          "新冠乳腺外科互联网诊疗",
          "特需超声引导介入门诊1",
          "肿瘤专科门诊(西院)",
          "口腔科(西院)(国际医疗)",
          "特需放射科门诊1",
          "血友病门诊(西院)",
          "普通妇科中心妇科组(东院)(普通)",
          "泌尿外科(转化楼)",
          "产科门诊",
          "核医学科门诊(西院)",
          "特需基本外科门诊1",
          "肝炎门诊",
          "特需基本外科门诊2",
          "国际医疗(缓和医学)",
          "心外科互联网诊疗",
          "国际医疗(胸外科)",
          "特需麻醉科门诊2",
          "特需麻醉科门诊1",
          "血液科门诊(西院国际医疗)",
          "临床药理研究中心",
          "日间医疗中心乳腺外科(西院)(普通)",
          "耳鼻喉科门诊(西院)",
          "整形美容外科淋巴水肿护理门诊(西院)",
          "眼科",
          "老年医学科门诊",
          "临床药理研究中心研究门诊",
          "康复医学科(西院国际医疗)",
          "全科医学科(普通内科)(西院国际医疗)",
          "血液内科互联网诊疗",
          "内科门诊",
          "内科ICU",
          "心外科门诊",
          "门诊部保健科互联网诊疗",
          "国际医疗(耳鼻喉科)",
          "妇科计划生育门诊(西院国际医疗)",
          "急诊内科",
          "特需心外科门诊1",
          "特需心内科门诊1",
          "消化内科互联网诊疗",
          "心理医学科门诊",
          "妇泌与生殖中心妇四病房内分泌组",
          "变态(过敏)反应科互联网诊疗",
          "超声介入门诊",
          "国际医疗(病理科)",
          "风湿免疫科",
          "眼科门诊(西院)",
          "国际医疗(神经科)",
          "血液内科",
          "特需心理医学科门诊2",
          "儿科互联网诊疗",
          "特需心内科门诊2",
          "罕见病医学科",
          "特需放疗科门诊2",
          "特需放疗科门诊1",
          "肿瘤内科门诊(西院国际医疗)",
          "中医科门诊",
          "消化内科门诊",
          "国际医疗(妇科计划生育)",
          "外科门诊(西院)",
          "核医学科(西院国际医疗)",
          "国际医疗部急诊科",
          "肾内科门诊(西院)",
          "骨科门诊(西院国际医疗)",
          "特需中医科联合门诊(西院)",
          "内分泌科门诊",
          "肝炎门诊互联网诊疗",
          "呼吸内科门诊",
          "肿瘤内科(西院)",
          "肿瘤内科门诊",
          "放射科门诊",
          "国际医疗(核医学科)",
          "特需妇科计划生育门诊2",
          "全科医学科(普通内科门诊)(西院)",
          "国际医疗部急诊眼科",
          "血液科门诊",
          "肿瘤内科随访和复诊门诊",
          "内分泌科互联网诊疗"
         ],
         "xaxis": "x",
         "y": [
          64353393.90999999,
          22008500.540000003,
          2309952.29,
          -3268.25,
          5376148.57,
          21901793.810000002,
          331434.04,
          -1372.2,
          1781495.4999999998,
          530491.51,
          704611.0699999998,
          4918330.220000001,
          19840944.490000002,
          705394.8600000001,
          350394.64,
          20926.630000000005,
          11688396.43,
          9181598.09,
          2984285.61,
          1127791.9,
          423759.7100000001,
          10559846.290000001,
          155235.77999999997,
          10695059.949999997,
          -4601.43,
          12130888.97,
          9359315.760000004,
          134412278.73999998,
          10158109.200000001,
          5794958.7299999995,
          610617.1099999999,
          216152.08000000007,
          299641364.3000001,
          5011519.78,
          -285.08,
          12901710.110000003,
          4316.36,
          412,
          1747845.66,
          699451.4000000001,
          14363771.269999996,
          12354574.219999997,
          675754.26,
          1334046.05,
          379616.04000000004,
          13725735.460000003,
          5263056.890000001,
          4926732.820000001,
          54760411.43999999,
          377092.39,
          1626362.54,
          0,
          6109793.090000001,
          1851796.5600000003,
          22440828.919999998,
          69668.07999999999,
          16523579.540000008,
          21162922.3,
          12684849.56,
          3041.4700000000003,
          2950386.27,
          698600.66,
          10463372.73,
          0,
          812487.45,
          365004.83,
          0,
          852,
          -4340.28,
          0,
          2306824.1100000003,
          5798085.349999999,
          16913.379999999997,
          1637643.6899999997,
          12986701.840000004,
          1764747.56,
          0,
          752340.59,
          1839929.1199999994,
          1948969.3900000004,
          6403441.249999998,
          165087.17,
          1716766.76,
          4346842.820000001,
          -770.4,
          2402360.88,
          1056434.0500000003,
          0,
          453288.01999999996,
          22673.579999999998,
          13682646.309999995,
          3364831.2300000004,
          721847.0700000001,
          12903199.100000001,
          6297737.670000002,
          11278623.360000003,
          58457730.56000001,
          421283.7800000001,
          47125.13,
          14764843.21,
          269138.19,
          7743982.680000002,
          27691574.990000006,
          0,
          149027287.17999995,
          -440.95,
          27341351.530000005,
          479679.35,
          21948.79,
          3139413.8299999996,
          36162566.69,
          28850423.73999999,
          463418.5300000001,
          549828.7300000001,
          145559.87,
          276477.31,
          6109197.439999999,
          30301.93,
          4496620.850000001,
          1241295.5999999999,
          37608756.88000001,
          65015219.7,
          5184457.06,
          2414240.8799999994,
          144800,
          1571805.16,
          1576072.4000000006,
          6194515.460000001,
          22695.51,
          5905534.77,
          6276572.020000001,
          4135312.2700000005,
          12631636.670000002,
          5547544.96,
          1380965.27,
          307947.83999999997,
          41113.7,
          9611239.53,
          -50,
          16950807.54,
          46428656.71000001,
          3161655.569999999,
          21169924.229999997,
          -3911.69,
          14641791.679999996,
          5180312.699999999,
          271658.01,
          2178833.4500000007,
          513236.51000000007,
          141855.74999999997,
          1400980.8199999998,
          3701218.3000000003,
          6293.9,
          3301923.0700000003,
          94906457.99999997,
          110484.48,
          128059.02999999996,
          11708223.320000004,
          4338685.08,
          881889.5800000001,
          23504191.46,
          1331222.9600000002,
          713242.0499999999,
          351335.91,
          17429215.810000006,
          6401205.8,
          7311.34,
          474535.49,
          700185.3200000002,
          224183.03999999998,
          732008.44,
          892929.8999999999,
          2562019.139999999,
          65191367.00000002,
          -282344.35,
          40789516.679999985,
          8875682.69,
          41007034.70000001,
          8704536.07,
          5767873.86,
          77764851.35,
          2149184.2800000003,
          6447244.790000002,
          747188.5299999998,
          7870652.700000001,
          -1443.64,
          172294.32,
          214.8,
          60081624.41999998,
          730,
          60,
          1036479.3100000002,
          10430345.670000004,
          7054974.1,
          9718711.23,
          16902740.939999998,
          1550869.9600000004,
          13488102.809999999,
          1277655.48,
          6290513.969999998,
          -80,
          395887152.39,
          1810993.9600000007,
          2304523.6799999992,
          0,
          1083199.7999999998,
          14715050.23,
          11484874.87,
          193970.52,
          40376034.42999999,
          28766671.000000004,
          16970929.22,
          6066.52,
          13387248.630000003,
          9809704.97,
          3936679.7299999995,
          471481.95999999996,
          2476730.13,
          1438106.1,
          232301.99999999997,
          61078430.23000001,
          3831660.1799999992,
          768272.9399999998,
          12987.89,
          8417428.19,
          86,
          1454970,
          12761.94,
          5748878.079999997,
          2383533.7400000007,
          0,
          16087663.280000003,
          64972.58,
          16963526.49999999,
          1456755.31,
          18125787.64,
          3991698.01,
          4930780.109999999,
          123981.78,
          22120.429999999997,
          4980278.919999999,
          3770.1,
          72064.99000000002,
          2253099.0099999993,
          224023.24999999997,
          7649730.469999997,
          328.29999999999995,
          34729.12,
          37812538.210000016,
          4453862.590000001,
          515341.74,
          600862.64,
          858616.24,
          5153662.9399999995,
          5646604.13,
          36776113.53,
          2435410.9600000004,
          487885.60000000003,
          10871281.209999999,
          1051490.2700000003,
          109933569.36999997,
          186005.36000000002,
          5357634.729999999,
          4182681.3500000006,
          10756852.400000002,
          219,
          698153.8,
          4498894.86,
          2660790,
          24288530.799999993,
          5855.860000000001,
          17020255.339999996,
          29452517.44,
          1276811.8800000006,
          2141169.6699999995,
          4012498.75,
          2841680.73,
          2565992.1700000004,
          6826493.189999999,
          6025271.109999999,
          41078360.60999999,
          31634786.859999985,
          4632223.989999999,
          0,
          662521.2,
          53800.02999999999,
          347978.0499999999,
          3676445.8400000003,
          4489.43,
          83545848.25999999,
          109262.51000000001,
          64044978.70999999,
          31990793.910000004,
          926266.4799999999,
          10868342.330000002,
          460466.61999999994,
          3321761.790000001,
          -234.53,
          284251.76,
          119742382.32999998,
          1334.99,
          7978493.93
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "患者科室"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "总收入"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.express as px\n",
    "import plotly.graph_objects as go\n",
    "\n",
    "# Decision-making for plot type\n",
    "if len(numeric_cols) >= 2:\n",
    "    # Use the first two numeric columns for a scatter plot\n",
    "    fig = px.scatter(df, x=numeric_cols[0], y=numeric_cols[1])\n",
    "elif len(numeric_cols) == 1 and len(categorical_cols) >= 1:\n",
    "    # Use a bar plot if there's one numeric and one categorical column\n",
    "    fig = px.bar(df, x=categorical_cols[0], y=numeric_cols[0])\n",
    "elif len(categorical_cols) >= 1 and df[categorical_cols[0]].nunique() < 10:\n",
    "    # Use a pie chart for categorical data with fewer unique values\n",
    "    fig = px.pie(df, names=categorical_cols[0])\n",
    "else:\n",
    "    # Default to a simple line plot if above conditions are not met\n",
    "    fig = px.line(df)\n",
    "\n",
    "fig.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "langflow",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
